package com.zhanghp.demo01.lambda;

import com.zhanghp.demo01.TravelStrategy;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zhanghp
 * @date 2022-08-30 16:41
 */
@Slf4j
public enum TravelEnumLambda implements TravelStrategy{
    BIKE(() -> {log.info("Bike to travel");}),
    CAR(() -> {log.info("Car to travel");});

    private TravelStrategy travelStrategy;

    TravelEnumLambda(TravelStrategy travelStrategy) {
        this.travelStrategy = travelStrategy;
    }

    @Override
    public void excute() {
        travelStrategy.excute();
    }
}
